package cn.wuweixiang.springbootdemo.filter;

import org.springframework.core.annotation.Order;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * DemoFilter
 *
 * @author weixiang.wu
 * @date 2018-08-22 20:43
 **/
/** Lower values have higher priority.*/
@Order(value = 1)
@WebFilter(urlPatterns = "/*")
public class DemoFilter implements Filter {
	@Override
	public void init(FilterConfig filterConfig) {
		System.err.println("DemoFilter.init");
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		System.err.println("DemoFilter.doFilter");
		chain.doFilter(request, response);
	}

	@Override
	public void destroy() {
		System.err.println("DemoFilter.destroy");
	}
}
